home *** CD-ROM | disk | FTP | other *** search
/ Day Cry / Day Cry CD.bin / oh_towns / ugoku / src.lzh / MOVRECG / MRCGTIF.C < prev    next >
Text File  |  1994-09-09  |  34KB  |  1,387 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <winb.h>
  5. #include <te.h>
  6. #include <fntb.h>
  7. #include <gui.h>
  8. #include <file_dlg.h>
  9. #include <tifflib.h>
  10. #include <egb.h>
  11. #include <mos.h>
  12. #include <snd.h>
  13. #include "ugoku.h"
  14. #include "video.h"
  15. #include "mrcdef.h"
  16.  
  17. extern    int        mouseSwCheck() ;
  18. extern    int        errorCheck( int ) ;
  19.  
  20. extern    char    *guiEgbPtr ;    /*    EGB é╠âÅü[âNâAâhâîâX    */
  21. extern    char    *rbuf ;            /*    Ä⌐ë╞É╗é╠âÅü[âNâAâhâîâX    */
  22. extern    char    *bbuf ;            /*    Ä⌐ë╞É╗é╠âÅü[âNâAâhâîâX    */
  23. extern char tifName[][16] ;
  24. extern int tifTotal ;
  25.  
  26. extern int    baseDialogId ;
  27.  
  28. int    tifDialogId[5] = -1 ;
  29. int    tifListMenuId0 = -1 ;
  30. int    tifScrollBarId0 = -1 ;
  31. int    tifMesId[16] = -1 ;
  32. int    tifTIconId[2] = -1 ;
  33. int    tifDButtonId[9] = -1 ;
  34. int    tifListMenuId1 = -1 ;
  35. int    tifNumBoxId = -1 ;
  36. int    tifScrollBarId1 = -1 ;
  37. int    tifWaitDialogId = -1 ;
  38.  
  39. int xtif, ytif;            /* ô╟é▌ì₧é±é╛tifâfü[â^ */
  40. int tifFirstFlg = 0 ;    /* ì┼Åëé═0,2ë±û┌ê╚ì~é═-1(tifâfâBâîâNâgâèò╧ìXé╚éτ0) */
  41.  
  42. static char name[ F_MAX+8 ][20] ;
  43. static int tifCutBuf[ F_MAX+8 ] ;
  44. static int total ;
  45. static int cutNum = 0 ;
  46. static int tifTMode = 0 ;
  47. static int tifPrt0 = 0 ;    /* ôoÿ^é│éΩé╜tifé╠ô¬ê╩Æu */
  48. static int tifPrt = 0 ;        /* ôoÿ^é│éΩé╜tifé╠î╗ì▌ê╩Æu */
  49. static char tifFilePath[100] ;    /* âpâXé≡ò█æ╢ */
  50.  
  51. tifFileEdit( path )
  52. char *path ;
  53. {
  54.     int i, j, n, m ;
  55.     char path2[100];
  56.  
  57.     MMI_SendMessage( tifDialogId[0], MM_ATTACH, 1, baseDialogId ) ;
  58.     MTL_setFlagObj( tifTIconId[tifTMode+0], (MS_UNSELECT | MS_TOGGLE) ) ;
  59.  
  60.     if( tifFirstFlg == 0 )
  61.     {
  62.         for( i=0 ; i<80 ; i++ )
  63.         {
  64.             path2[i] = path[i] ;
  65.             tifFilePath[i] = path[i] ;
  66.             if( path[i] == '\0' )break ;
  67.         }
  68.         path2[i++] = '*';
  69.         path2[i++] = '.';
  70.         path2[i++] = 'T';
  71.         path2[i++] = 'I';
  72.         path2[i++] = 'F';
  73.         path2[i++] = '\0';
  74.  
  75.         total = look_files_all( name, path2 );
  76.         look_file_seiri( total, name );
  77.  
  78.         /*    âèâXâgâüâjâàü[é╠É▌ÆΦ */
  79.         MTL_resetAtrObj(tifListMenuId0, ((~MS_SCROLLL40) & (~MS_MSELECTL40)) );
  80.         if( tifTMode )
  81.             MTL_setAtrObj(tifListMenuId0, (MS_SCROLLL40 | MS_MSELECTL40) ) ;
  82.         else
  83.             MTL_setAtrObj(tifListMenuId0, MS_SCROLLL40 ) ;
  84.         MMI_SendMessage(tifListMenuId0, MM_SETMAXROWCOLUM, 2, 0, 0) ;
  85.         MMI_SendMessage(tifListMenuId0, MM_SETMAXROWCOLUM, 2, total+32, 1) ;
  86.         MMI_SendMessage(tifListMenuId0, MM_SETCOLUMLEN, 2, 0, 16) ;
  87.  
  88.         MTL_setAtrObj(tifListMenuId1, (MS_SCROLLL40 | MS_MSELECTL40) ) ;
  89.         MMI_SendMessage(tifListMenuId1, MM_SETMAXROWCOLUM, 2, 0, 0) ;
  90.         MMI_SendMessage(tifListMenuId1, MM_SETMAXROWCOLUM, 2, F_MAX+32, 1) ;
  91.         MMI_SendMessage(tifListMenuId1, MM_SETCOLUMLEN, 2, 0, 16) ;
  92.         tifTotal = 0 ;
  93.         tifPrt = tifTotal ;
  94.         tifPrt0 = 0 ;
  95.         tifFirstFlg = -1 ;
  96.  
  97.         for (i = 0 ; i < total ; i++)
  98.             MMI_SendMessage(tifListMenuId0, MM_SETROWCOLUM,
  99.              3, i, 0, name[i]) ;
  100.         n = 24 ; m = total + 23 ;
  101.         MMI_SendMessage( tifScrollBarId0, MM_SETSCROLL, 5,
  102.             n-1, n-1, (m < n)?(n - 1):(m - 1), n, 4 ) ;
  103.  
  104.         for (i = 0 ; i < tifTotal ; i++)
  105.             MMI_SendMessage(tifListMenuId1, MM_SETROWCOLUM,
  106.              3, i, 0, tifName[i]) ;
  107.         n = 24 ; m = tifTotal + 23 ;
  108.         MMI_SendMessage( tifScrollBarId1, MM_SETSCROLL, 5,
  109.             n-1, n-1, (m < n)?(n - 1):(m - 1), n, 4 ) ;
  110.     }
  111.  
  112.     cutNum = 0 ;
  113.  
  114.     tifFileEditButton( 0 ) ;
  115.  
  116.     MMI_SendMessage( tifDialogId[0], MM_SHOW, 0 ) ; /* î⌐é╣éΘ */
  117.  
  118.     MMI_ExecSystem() ;        /* Dialogò\Īé╓ÑÑÑâCâxâôâgâïü[âv */
  119.  
  120.     LISTITEML40 *plitem ;
  121.     int maxRow, maxColum ;
  122.  
  123.     MMI_SendMessage( tifListMenuId1, MM_GETLMENUPTR, 3,
  124.                         &plitem, &maxRow, &maxColum ) ;
  125.     for( i=0 ; i<tifTotal ; i++ )
  126.     {
  127.         for( j=0 ; j<13 ; j++ )
  128.         {
  129.             tifName[i][j] = (plitem[i].string)[j] ;
  130.             if( tifName[i][j] == '\0' )break ;
  131.         }
  132.     }
  133.  
  134.     MMI_SendMessage( tifDialogId[0], MM_ERASE, 0 ) ;
  135.     MMI_SendMessage( tifDialogId[0], MM_DETACH, 0 ) ;
  136.  
  137.     return NOERR ;
  138. }
  139.  
  140. /* â{â^âôé╠ùLî°Ñû│î°É▌ÆΦâïü[â`âô */
  141. tifFileEditButton( mode )    /* mode!=0é╚éτSHOWé╖éΘ */
  142. int mode ;
  143. {
  144.     int i, atr[6], atr2 ;
  145.  
  146.     for( i=0 ; i<6 ; i++ )
  147.     {
  148.         atr[i] = MS_DSPONLYL40 ;
  149.         atr[i] = MTL_checkAtrObj( tifDButtonId[i], atr[i] ) ;
  150.     }
  151.  
  152.     MTL_resetAtrObj( tifDButtonId[0], (~MS_DSPONLYL40) ) ;    /* 1ü`2bit clear */
  153.     MTL_resetAtrObj( tifMesId[0], (~MS_DSPONLYL40) ) ;
  154.     MTL_resetAtrObj( tifDButtonId[2], (~MS_DSPONLYL40) ) ;
  155.     MTL_resetAtrObj( tifMesId[2], (~MS_DSPONLYL40) ) ;
  156.     MTL_resetAtrObj( tifDButtonId[3], (~MS_DSPONLYL40) ) ;
  157.     MTL_resetAtrObj( tifMesId[3], (~MS_DSPONLYL40) ) ;
  158.     MTL_resetAtrObj( tifDButtonId[4], (~MS_DSPONLYL40) ) ;
  159.     MTL_resetAtrObj( tifMesId[4], (~MS_DSPONLYL40) ) ;
  160.     MTL_resetAtrObj( tifDButtonId[5], (~MS_DSPONLYL40) ) ;
  161.     MTL_resetAtrObj( tifMesId[5], (~MS_DSPONLYL40) ) ;
  162.  
  163.         /* êΩèçô]æù */
  164.     if( tifTMode == 0 )
  165.     {
  166.         MTL_setAtrObj( tifDButtonId[0], MS_INACTIVEL40 ) ;
  167.         MTL_setAtrObj( tifMesId[0], MS_INACTIVEL40 ) ;
  168.     }
  169.     else
  170.     {
  171.         MTL_setAtrObj( tifMesId[0], MS_DSPONLYL40 ) ;
  172.     }
  173.         /* ò\Ī,ìφÅ£,ĵô╛ */
  174.     if( tifTotal == tifPrt )
  175.     {
  176.         MTL_setAtrObj( tifDButtonId[2], MS_INACTIVEL40 ) ;
  177.         MTL_setAtrObj( tifMesId[2], MS_INACTIVEL40 ) ;
  178.         MTL_setAtrObj( tifDButtonId[3], MS_INACTIVEL40 ) ;
  179.         MTL_setAtrObj( tifMesId[3], MS_INACTIVEL40 ) ;
  180.         MTL_setAtrObj( tifDButtonId[4], MS_INACTIVEL40 ) ;
  181.         MTL_setAtrObj( tifMesId[4], MS_INACTIVEL40 ) ;
  182.     }
  183.     else
  184.     {
  185.         MTL_setAtrObj( tifMesId[2], MS_DSPONLYL40 ) ;
  186.         MTL_setAtrObj( tifMesId[3], MS_DSPONLYL40 ) ;
  187.         MTL_setAtrObj( tifMesId[4], MS_DSPONLYL40 ) ;
  188.     }
  189.         /* æ}ôⁿ */
  190.     if( cutNum == 0 )
  191.     {
  192.         MTL_setAtrObj( tifDButtonId[5], MS_INACTIVEL40 ) ;
  193.         MTL_setAtrObj( tifMesId[5], MS_INACTIVEL40 ) ;
  194.     }
  195.     else
  196.     {
  197.         MTL_setAtrObj( tifMesId[5], MS_DSPONLYL40 ) ;
  198.     }
  199.  
  200.     if( mode )
  201.     {
  202.         for( i=0 ; i<6 ; i++ )
  203.         {
  204.             atr2 = MS_DSPONLYL40 ;
  205.             atr2 = MTL_checkAtrObj( tifDButtonId[i], atr2 ) ;
  206.             if( atr2 != atr[i] )
  207.             {
  208.                 MMI_SendMessage( tifDButtonId[i], MM_SHOW, 0 ) ; /* î⌐é╣éΘ */
  209.                 MMI_SendMessage( tifMesId[i], MM_SHOW, 0 ) ;
  210.             }
  211.         }
  212.     }
  213.     return NOERR ;
  214. }
  215.  
  216. tifFileEditList1()
  217. {
  218.     int n, m ;
  219.     int prt, max, min, len, page ;
  220.  
  221.     n = 24 ; m = tifTotal + 23 ;
  222.     MMI_SendMessage( tifScrollBarId1, MM_SETSCROLL, 5,
  223.         n-1, n-1, (m < n)?(n - 1):(m - 1), n, 4 ) ;
  224.  
  225.     MMI_SendMessage( tifNumBoxId, MM_SETNUMBOX, 5,
  226.                             tifTotal, 0, tifTotal, 1, 0 ) ;
  227.  
  228.     MMI_SendMessage( tifScrollBarId1, MM_GETSCROLL, 5,
  229.                         &prt, &min, &max, &len, &page ) ;
  230.     MMI_SendMessage( tifScrollBarId1, MM_SETSCROLL, 5,
  231.                         tifPrt0+min, min, max, len, page ) ;
  232.     MMI_SendMessage( tifListMenuId1, MM_SETDSPROWCOLUM, 2, tifPrt0, 0 ) ;
  233.  
  234.     MMI_SendMessage( tifNumBoxId, MM_SHOW, 0 ) ;
  235.     MMI_SendMessage( tifScrollBarId1, MM_SHOW, 0 ) ;
  236.     MMI_SendMessage( tifListMenuId1, MM_SHOW, 0 ) ;
  237.  
  238.     return NOERR ;
  239. }
  240.  
  241. /*    initDataIRCTIF:tifListMenuId0:MJ_LMENUL40é╠î─é╤Åoé╡è╓Éö    */
  242. int    tifListFunc0(kobj, messId, argc, pev, trigger)
  243. int        kobj ;
  244. int        messId ;
  245. int        argc ;
  246. EVENT    *pev ;
  247. int        trigger ;
  248. {
  249.     if( trigger & MS_EVDRAGOUTL40 )
  250.     {
  251.         int prt, len, page ;
  252.         int max, min ;
  253.         int dy ;
  254.         POINT *ppt ;
  255.         HYPER hyp ;
  256.  
  257.         MMI_SendMessage( kobj, MM_GETHYPER, 1, &hyp ) ;
  258.         ppt = ( POINT *)&( pev->info ) ;
  259.         dy = 0 ;
  260.  
  261.         if( ppt->y < hyp.fr.lupy )
  262.             dy = -1 ;
  263.         if( ppt->y > hyp.fr.rdwy )
  264.             dy = 1 ;
  265.  
  266.         if( dy )
  267.         {
  268.             MMI_SendMessage( tifScrollBarId0, MM_GETSCROLL, 5,
  269.                         &prt, &min, &max, &len, &page ) ;
  270.  
  271.             prt += dy ;
  272.  
  273.             if( (min <= prt) && (prt <= max) )
  274.             {
  275.                 MMI_SendMessage( tifScrollBarId0, MM_SETSCROLL, 5,
  276.                         prt, min, max, len, page ) ;
  277.                 MMI_SendMessage( kobj, MM_SETDSPROWCOLUM, 2, prt-min, 0 ) ;
  278.                 MMI_SendMessage( tifScrollBarId0, MM_SHOW, 0 ) ;
  279.                 MMI_SendMessage( kobj, MM_SHOW, 0 ) ;
  280.             }
  281.         }
  282.         return NOERR ;
  283.     }
  284.  
  285.     if( tifTMode == 0 )
  286.     {
  287.         LISTITEML40 *plitem0, *plitem1 ;
  288.         int maxRow0, maxColum0 ;
  289.         int maxRow1, maxColum1 ;
  290.         int i, j ;
  291.  
  292.         if( tifTotal >= F_MAX )
  293.             return NOERR ;
  294.  
  295.         MMI_SendMessage( kobj, MM_GETLMENUPTR, 3,
  296.                         &plitem0, &maxRow0, &maxColum0 ) ;
  297.         MMI_SendMessage( tifListMenuId1, MM_GETLMENUPTR, 3,
  298.                         &plitem1, &maxRow1, &maxColum1 ) ;
  299.  
  300.         for( i=0 ; i<total ; i++ )
  301.         {
  302.             if( plitem0[i].selectFlag )
  303.             {
  304.                 if( tifTotal > tifPrt )
  305.                 {
  306.                     for( j=tifTotal ; j>tifPrt ; j-- )
  307.                     {
  308.                         if( plitem1[j-1].string != NULL )
  309.                         {
  310.                             MMI_SendMessage( tifLi